package com.fast.develop.management.resource.schema;

import com.fast.develop.management.SchemaManager;
import com.fast.develop.management.resource.compoment.SchemaWriter;
import com.fast.develop.management.resource.utils.SchemaFileUtil;

/**
 * @author 莫寅
 * @createTime 2022-06-16 22:19
 * @desc：
 */
public class DefaultSchemaManager implements SchemaManager {

    private SchemaWriter schemaWriter;

    public DefaultSchemaManager(SchemaWriter schemaWriter) {
        this.schemaWriter = schemaWriter;
    }

    @Override
    public String create(String metaType, String path) {
        //是否是
        schemaWriter.write(metaType, path, null);

        return SchemaFileUtil.createPath(path);
    }

    @Override
    public String write(String metaType, String path, String value) {
        schemaWriter.write(metaType, path, value);

        return SchemaFileUtil.createPath(path);
    }

    @Override
    public String enable(String metaType, String path) {
        schemaWriter.enable(metaType, path);

        return SchemaFileUtil.createPath(path);
    }

    @Override
    public String disable(String metaType, String path) {
        schemaWriter.disable(metaType, path);

        return SchemaFileUtil.createPath(path);
    }
}
